<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:l="http://www.lapis.com/jsf/exporter">

<h:head>
	<h:outputStylesheet name="global.css" library="css" />
	<h:outputScript name="global.js" library="javascript"/>
	<h:outputScript name="validacao.js" library="javascript"/>
	<h:outputScript name="restricoes_de_campos.js" library="javascript"/>
</h:head>

<h:body>
	<h1>Data table Test</h1>
	
	<h:form id="list">
	
	<div align="center">
		<p:commandButton value="PDF">
			<l:dataExporter fileType="pdf" source="teste" fileName="teste"/>
		</p:commandButton>
	</div>
	<br />
	<div align="center">
		<p:commandButton value="Excel">
		</p:commandButton>
	</div>
	<br />
	
	<h:panelGroup id="teste">
		<table border="4" cellspacing="4" cellpadding="10">
	        <tr>
	            <th rowspan="2">A</th>
	            <th rowspan="2">B</th>
	            <th colspan="4">C</th>
	        </tr>
	        <tr>
	            <th>p1</th>
	            <th>p2</th>
	            <th>p3</th>
	            <th>p4</th>
	        </tr>
	        <ui:repeat var="classa" value="#{master.classesA}" varStatus="astat">
	            <ui:repeat var="classb" value="#{classa.classesB}"  varStatus="bstat">
	                <ui:repeat value="#{classb.classesC}" var="classc" varStatus="cstat">
	
	                    <tr>
	                        <h:panelGroup rendered="#{bstat.index eq 0 and cstat.index eq 0}">
	                            <td rowspan="#{classa.colSpan}" >
	                                <h:outputText value="#{classa.property}" />
	                            </td>
	                        </h:panelGroup>
	                        <h:panelGroup rendered="#{cstat.index eq 0}">
	                            <td rowspan="#{classb.classesC.size()}">                                                   
	                                <h:outputText value="#{classb.property}" />
	                            </td>
	                        </h:panelGroup>
	
	                        <td>
	                            <h:outputText value="#{classc.prop1}" />
	                        </td>
	                        <td>
	                            <h:outputText value="#{classc.prop2}" />
	                        </td>
	                        <td>
	                            <h:outputText value="#{classc.prop3}" />
	                        </td>
	                        <td>
	                            <h:outputText value="#{classc.prop4}" />
	                        </td>
	                    </tr>  
	                </ui:repeat>
	
	            </ui:repeat>
	
	        </ui:repeat>
	    </table>
	</h:panelGroup>	
        	
	</h:form>
</h:body>
</html>
